import axios from "../utils/request";
import http from "../utils/upload";
import path from "./path";
import { FormTypeEnum } from "@/utils/enum";
const api = {
  //首页三种工单分页接口
  institutionMainPage(type, query) {
    let url = path.baseUrl + path.institutionPage;
    switch (type) {
      case FormTypeEnum.TODO:
        url = path.baseUrl + path.institutionPage;
        break
      case FormTypeEnum.DELAY:
        url = path.baseUrl + path.institutionDelayPage;
        break
      case FormTypeEnum.ROLLBACK:
        url = path.baseUrl + path.institutionBackPage;
        break
      default:
        url;
        break
    }
    return axios({
      url: url,
      method: "get",
      params: query,
    });
  },

  //工单处理，查看，审核的详情接口
  institutionDetail(query) {
    return axios({
      url: path.baseUrl + path.institutionDetail,
      method: "get",
      params: query,
    });
  },


  //工单审核接口
  institutionMainExamine(type, params) {
    let url = path.baseUrl + path.institutionExamine;
    switch (type) {
      case FormTypeEnum.TODO:
        url = path.baseUrl + path.institutionExamine;
        break
      case FormTypeEnum.DELAY:
        url = path.baseUrl + path.institutionDelayExamine;
        break
      case FormTypeEnum.ROLLBACK:
        url = path.baseUrl + path.institutionBackExamine;
        break
      default:
        url;
        break
    }
    return axios.post(url,params)
  },

  //处理工单暂存，提交接口
  institutionSubmit(params) {
    return axios({
      url: path.baseUrl + path.institutionSubmit,
      method: "post",
      data: params,
    });
  },

  //处理工单暂存，提交接口
  getOrganizationList(query) { 
    return axios({
      url: path.baseUrl + path.getOrganizationList,
      method: "get",
      params: query,
    });
  },

  //登录接口
  authLogin(query) { 
    return axios({
      url: path.baseUrl + path.authLogin,
      method: "post",
      data: query,
    });
  },

  //上传图片接口
  uploadFile(data) {
    return http.upload({
      url: path.baseUrl + path.fileUpload,
      data: data
    });
  },

  // // 活动打卡接口
  // insertActivity(data) {
  //   return axios.post(path.baseUrl + path.insertActivity, data);
  // },


};

export default api;
